package ltd.hyangyang.rpc.client.controller;

import ltd.hyangyang.rpc.client.service.MessageService;
import ltd.hyangyang.rpc.core.anno.ServiceReference;
import ltd.hyangyang.rpc.entity.ClientMessage;
import ltd.hyangyang.rpc.entity.ServerMessage;
import org.springframework.stereotype.Component;

@Component
public class MessageController {

    @ServiceReference(serviceName = "ltd.hyangyang.rpc.server.service.impl.MessageServiceImpl",group = "impl1")
    public MessageService messageService;

    public void hello(ClientMessage message){
        try {
            ServerMessage serverMessage = messageService.getMessage(message);
            System.out.println(serverMessage);
        }catch (Exception e){
            e.printStackTrace();
        }

    }

}
